var /**
	 * 仿真流程管理
	 */
TeachFlow = cc.Class.extend({
	step:0,
	flow:null,
	main:null,
	over_flag: false,
	curSprite:null,
	ctor: function(){
		this.init();
	},
	setMain:function(main){
		this.main=main;
	},
	init: function(){
		for(var i in teach_flow){
			teach_flow[i].finish = false;
			teach_flow[i].cur = false;
			if(teach_flow[i].action == null){
				teach_flow[i].action = ACTION_NONE;
			}
		}
	},
	start:/**
			 * 开始流程
			 */
	function(){
		this.over_flag = false;
		this.step = 0;
		
		/* 新标准，开始的时候，执行下一步 */
		this.next();
	},
	over:/**
			 * 流程结束，计算分数，跳转到结束场景，
			 */
	function(){
		this.over_flag = true;
		this.flow = over;
		gg.lastStep = this.step;
		this.main.over();
	},
	checkTag:/**
				 * 检查是否当前步骤
				 * 
				 * @deprecated 使用新Angel类，不再判断是否当前步骤
				 * @param tag
				 * @returns {Boolean}
				 */
	function(tag){
		var cur_flow = teach_flow[this.step - 1];
		if(cur_flow.tag == tag){
			return true;
		} else {
			return false;
		}
	},
	prev:/**
			 * 回退一定步数
			 * 
			 * @deprecated 需结合具体实现，，暂时不再启动
			 * @param count
			 *            步数
			 */
	function(count){
		if(this.curSprite!=null){
			this.curSprite = null;
		}
		if(this.flow!=null){
			this.flow.cur = false;
		}
		this.step = this.step - count;
		this.flow = teach_flow[this.step - 1];
		this.refresh();
		gg.score -= 11;
	},
	next:/**
			 * 执行下一步操作， 定位当前任务
			 */
	function(){
		if(this.over_flag){
			return;
		}
		if(this.curSprite!=null){
			this.curSprite.setEnable(false)
			this.curSprite = null;
		}
		if(this.flow!=null){
			this.flow.cur = false;
			// 标记任务已完成
			this.flow.finish = true;
		}
		this.flow = teach_flow[this.step++];
		if(this.flow.finish){
			// 如果任务已完成，跳过当前步骤
			this.next();
		}
		this.refresh();
	},
	refresh:/**
			 * 刷新当前任务状态，设置闪现，点击等状态
			 */
	function(){
		// 刷新提示
		this.flow.cur = true;
		if(this.flow.tip != null){
			ll.tip.tip.doTip(this.flow.tip);
		}
		if(this.flow.flash != null){
			ll.tip.flash.doFlash(this.flow.flash);
		}
		if(this.step > teach_flow.length - 1){
			this.over();
		}
		this.initCurSprite();
		if(this.curSprite!=null){
			this.location();
			this.curSprite.setEnable(true);
		}
	},
	location:/**
	 * 定位箭头
	 */
		function(){
		var tag = gg.flow.flow.tag;
		if(tag instanceof Array){
			if(TAG_LIB_MIN < tag[1]){
				if(ll.run.lib.isOpen()){
					ll.tip.arr.pos(this.curSprite);
				}else{
					ll.tip.arr.setPosition(gg.width-45,455);
				}
			}else{
				ll.tip.arr.pos(this.curSprite);
			}
		}
		else {
			ll.tip.arr.pos(this.curSprite);
		}		
	},
	getStep:/**
			 * 获取当前步数
			 * 
			 * @returns {Number}
			 */
	function(){
		return this.step;
	},
	initCurSprite:/**
					 * 遍历获取当前任务的操作对象
					 */
	function(){
		var tag = this.flow.tag;
		if(tag == null || tag == undefined){
			return;
		}
		var root = ll.run;
		var sprite = null;
		if(tag == TAG_BUTTON_LIB){
			sprite = ll.tool.getChildByTag(tag);
		} else if(tag instanceof Array){
			// 数组
			for (var i in tag) {
				root = root.getChildByTag(tag[i]);
			}
			sprite = root;
		} else {
			// 单个tag
			var sprite = root.getChildByTag(tag);
		}
		if(sprite != null){
			this.curSprite = sprite;
			return;
		}
	}
});

// 任务流
teach_flow = [

	{tip:"打开物品库",tag:TAG_BUTTON_LIB},
	{tip:"取出装有自来水的洗涤瓶",tag:[TAG_LIB,TAG_LIB_ZILAISHUI],action:ACTION_DO1},	
	{tip:"取出滴定管架",tag:[TAG_LIB,TAG_LIB_IRON]},
	{tip:"取出酸式滴定管",tag:[TAG_LIB,TAG_LIB_DDG],othertag:[TAG_LEFT,TAG_LEFT_PART]},
	
	{tip:"向滴定管中加自来水至0刻度以上",tag:[TAG_BOTTLE1,TAG_ZILAISHUI],action:ACTION_DO1},
	{tip:"取出吸水纸,擦干滴定管外壁",tag:[TAG_LIB,TAG_LIB_XISHUIZHI],action:ACTION_DO1},
	{tip:"取出废液缸",tag:[TAG_LIB,TAG_LIB_BEAKER],action:ACTION_DO1},
	{tip:"将酸式滴定管移至废液缸上",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO2},
	{tip:"转动活塞，调整水位线为0刻度",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO3},
	{tip:"将酸式滴定管安装在滴定管夹",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO1},
	{tip:"等待2分钟，查看是否有漏水现象"},
	{tip:"转动活塞180度",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO1},
	{tip:"等待2分钟，查看是否有漏水现象"},	
	{tip:"取下滴定管,查看刻度是否为0,并从上端倒至废液缸",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO9},
	
	{tip:"加入10毫升左右自来水",tag:[TAG_BOTTLE1,TAG_ZILAISHUI],action:ACTION_DO2},	
	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO3},
	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	{tip:"剩余液体，从上端倒至废液缸",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:Y1},
	////重复自来水润洗
	//	{tip:"加10毫升左右自来水",tag:[TAG_BOTTLE1,TAG_ZILAISHUI],action:ACTION_DO2},	
	//	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO3},
	//	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	//	{tip:"剩余液体，从上端倒至废液缸",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO5},
	//	{tip:"加10毫升左右自来水",tag:[TAG_BOTTLE1,TAG_ZILAISHUI],action:ACTION_DO2},	
	//	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO3},
	//	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	//	{tip:"剩余液体，从上端倒至废液缸",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO5},
	
	{tip:"取出装有蒸馏水的洗涤瓶",tag:[TAG_LIB,TAG_LIB_ZHENGLIUSHUI],action:ACTION_DO1},
	{tip:"加入10毫升左右蒸馏水",tag:[TAG_BOTTLE2,TAG_ZHENGLIUSHUI],action:ACTION_DO1},	
	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO3},
	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	{tip:"剩余液体，从上端倒至废液缸",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:Y2},
	////重复蒸馏水润洗	
	//	{tip:"加10毫升左右蒸馏水",tag:[TAG_BOTTLE2,TAG_ZHENGLIUSHUI],action:ACTION_DO1},	
	//	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO3},
	//	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	//	{tip:"剩余液体，从上端倒至废液缸",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO5},
	//	{tip:"加10毫升左右蒸馏水",tag:[TAG_BOTTLE2,TAG_ZHENGLIUSHUI],action:ACTION_DO1},	
	//	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO3},
	//	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	//	{tip:"剩余液体，从上端倒至废液缸",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO5},
	
	{tip:"取出操作液标准盐酸",tag:[TAG_LIB,TAG_LIB_HCL]},
	{tip:"使用前，摇匀",tag:[TAG_HCL_BOTTLE,TAG_HCL],action:ACTION_DO1},
	{tip:"打开瓶塞",tag:[TAG_HCL_BOTTLE,TAG_HCL_LID],othertag:[3027],action:ACTION_DO1},
	{tip:"加入10毫升左右盐酸",tag:[TAG_HCL_BOTTLE,TAG_HCL],action:ACTION_DO2},
	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO3},
	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	{tip:"剩余液体，从上端倒至废液缸",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:Y3},
	////重复标准盐酸润洗	
	//	{tip:"加10毫升左右盐酸",tag:[TAG_HCL_BOTTLE,TAG_HCL],action:ACTION_DO2},
	//	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO3},
	//	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	//	{tip:"剩余液体，从上端倾倒到废液缸",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO5},
	//	{tip:"加10毫升左右盐酸",tag:[TAG_HCL_BOTTLE,TAG_HCL],action:ACTION_DO2},
	//	{tip:"滴定管横向转动几周，进行清洗",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO3},
	//	{tip:"转动活塞，少量冲洗下端后并及时关闭",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO2},
	//	{tip:"剩余液体，从上端倾倒到废液缸",tag:[TAG_DDG_DDG,TAG_DDG],action:ACTION_DO5},
	
	{tip:"加入盐酸至0刻度以上",tag:[TAG_HCL_BOTTLE,TAG_HCL],action:ACTION_DO3},
	{tip:"移至废液缸上，自然下垂",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO4},
	{tip:"调整活塞使盐酸降至0刻度",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO3},
	{tip:"移至滴定管夹",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO1},
	{tip:"静置2分钟，待管壁内液体流下"},
	{tip:"移至废液缸上，自然下垂",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO4},
	{tip:"再次调整活塞至0刻度",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],action:ACTION_DO7},
	{tip:"调整完成，移至滴定管架滴定管夹夹住",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO6},
	
	{tip:"取出1号烧杯",tag:[TAG_LIB,TAG_LIB_BEAKER],action:ACTION_DO2},
	{tip:"取出装有自来水的洗涤瓶",tag:[TAG_LIB,TAG_LIB_ZILAISHUI]},	
	{tip:"向烧杯加入适量自来水",tag:[TAG_BOTTLE1,TAG_ZILAISHUI],action:ACTION_DO3},
	{tip:"取出移液管",tag:[TAG_LIB,TAG_LIB_YIYEGUAN]},
	{tip:"移液管移至1号烧杯上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO1},
	{tip:"待洗耳球吸取管三分之一液体后，迅速食指按住管口",tag:[TAG_LIB,TAG_LIB_XIERQIU],othertag:[3055,3056],action:ACTION_DO1},
	{tip:"横向转动几周清洗后，清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],othertag:[3054,3052],action:Y1},
	////重复自来水润洗	
	//	{tip:"移液管移至烧杯上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO1},
	//	{tip:"待洗耳球吸取管三分之一液体后，迅速食指按住管口",tag:[TAG_YYG_YYG,TAG_XIERQIU],action:ACTION_DO1},
	//	{tip:"横向转动几周清洗后，清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO2},	
	//	{tip:"移液管移至烧杯上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO1},
	//	{tip:"待洗耳球吸取管三分之一液体后，迅速食指按住管口",tag:[TAG_YYG_YYG,TAG_XIERQIU],action:ACTION_DO1},
	//	{tip:"横向转动几周清洗后，清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO4},
	
	{tip:"取出2号烧杯",tag:[TAG_LIB,TAG_LIB_BEAKER]},
	{tip:"取出装有蒸馏水的洗涤瓶",tag:[TAG_LIB,TAG_LIB_ZHENGLIUSHUI]},
	{tip:"向烧杯加入适量蒸馏水,",tag:[TAG_BOTTLE2,TAG_ZHENGLIUSHUI],action:ACTION_DO2},
	{tip:"移液管移至2号烧杯上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO1},
	{tip:"待洗耳球吸取管三分之一液体后，迅速食指按住管口",tag:[TAG_LIB,TAG_LIB_XIERQIU],othertag:[3055,3056],action:ACTION_DO2},
	{tip:"横向转动几周清洗后，清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],othertag:[3054,3052],action:Y2},
	////重复蒸馏水润洗
	//	{tip:"移液管移至2号烧杯上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO1},
	//	{tip:"待洗耳球吸取管三分之一液体后，迅速食指按住管口",tag:[TAG_YYG_YYG,TAG_XIERQIU],action:ACTION_DO2},
	//	{tip:"迅速食指按住管口，横向转动清洗后清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO2},
	//	{tip:"移液管移至2号烧杯上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO1},
	//	{tip:"待洗耳球吸取管三分之一液体后，迅速食指按住管口",tag:[TAG_YYG_YYG,TAG_XIERQIU],action:ACTION_DO2},
	//	{tip:"横向转动几周清洗后，清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO4},
	
	{tip:"取出待测的混合碱液,",tag:[TAG_LIB,TAG_LIB_JIANYE]},
	{tip:"打开橡胶塞,",tag:[TAG_JIANYE_BOTTLE,TAG_LID],othertag:[3015]},
	{tip:"移液管移至待测混合碱液上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO5},
	{tip:"待洗耳球吸取管三分之一液体后，迅速食指按住管口",tag:[TAG_LIB,TAG_LIB_XIERQIU],othertag:[3055,3056],action:ACTION_DO3},
	{tip:"横向转动几周清洗后，清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],othertag:[3054,3052],action:Y3},
	////重复待测液润洗
	//	{tip:"移液管移至待测碱液上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO5},
	//	{tip:"洗耳球移至移液管上方，吸取管三分之一液体",tag:[TAG_YYG_YYG,TAG_XIERQIU],action:ACTION_DO3},
	//	{tip:"迅速食指按住管口，横向转动清洗后清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO3},
	//	{tip:"移液管移至待测碱液上",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO5},
	//	{tip:"洗耳球移至移液管上方，吸取管三分之一液体",tag:[TAG_YYG_YYG,TAG_XIERQIU],action:ACTION_DO3},
	//	{tip:"迅速食指按住管口，横向转动清洗后清洗液流至废液缸",tag:[TAG_YYG_YYG,TAG_YYG],action:ACTION_DO3},
     
	{tip:"移液管移至待测混合碱液上",tag:[TAG_YYG_YYG,TAG_YYG],othertag:[3054,3052],action:ACTION_DO5},
	{tip:"待洗耳球吸取0刻度线上，迅速食指按住管口",tag:[TAG_LIB,TAG_LIB_XIERQIU],othertag:[3055,3056]},
	{tip:"移至废液缸，调整至0刻度",tag:[TAG_YYG_YYG,TAG_YYG],othertag:[3054,3052],action:ACTION_DO6},
	{tip:"取出吸水纸,擦干移液管外壁",tag:[TAG_LIB,TAG_LIB_XISHUIZHI]},
	{tip:"取出锥形瓶",tag:[TAG_LIB,TAG_LIB_ZHUIXINGPING]},
	{tip:"将待测混合碱液转移至锥形瓶",tag:[TAG_YYG_YYG,TAG_YYG],othertag:[3054,3052],action:ACTION_DO7},
	
	{tip:"取出酚酞试剂,",tag:[TAG_LIB,TAG_LIB_FENTAI]},
	{tip:"向锥形瓶内滴入2滴酚酞试剂",tag:[TAG_FENTAI_BOTTLE,TAG_DI],othertag:[3020],action:ACTION_DO1},
	{tip:"锥形瓶摇匀溶液呈红色，并移至滴定管下",tag:[TAG_ZHUI_BOTTLE,TAG_ZHUIXINGPING1]},
	{tip:"慢慢打开活塞，开始滴定，同时摇匀锥形瓶",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],othertag:[3049,3048],action:ACTION_DO4},
	{tip:"待溶液呈很淡的粉红色时停止滴定",tag:[TAG_ZHUI_BOTTLE,TAG_ZHUIXINGPING3],othertag:[3049]},
	{tip:"用蒸馏水润洗瓶壁",tag:[TAG_BOTTLE2,TAG_ZHENGLIUSHUI],action:ACTION_DO3},
	{tip:"取下滴定管，垂直放置，读取消耗盐酸体积V1,",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO7},
	{tip:"取出甲基橙试剂",tag:[TAG_LIB,TAG_LIB_JIAJICHENG]},
	{tip:"向锥形瓶内滴入2滴甲基橙试剂",tag:[TAG_JIAJICHENG_BOTTLE,TAG_DI],othertag:[3022],action:ACTION_DO1},
	{tip:"锥形瓶摇匀溶液呈黄色，并移至滴定管下",tag:[TAG_ZHUI_BOTTLE,TAG_ZHUIXINGPING2]},
	{tip:"慢慢打开活塞，开始滴定，同时摇匀锥形瓶",tag:[TAG_DDG_DDG,TAG_DDG,TAG_HUOSAI],othertag:[3049,3048],action:ACTION_DO5},
	{tip:"待溶液呈橙色时停止滴定",tag:[TAG_ZHUI_BOTTLE,TAG_ZHUIXINGPING4],othertag:[3049]},
	{tip:"用蒸馏水润洗瓶壁",tag:[TAG_BOTTLE2,TAG_ZHENGLIUSHUI],action:ACTION_DO3},
	{tip:"取下滴定管，垂直放置，读取消耗盐酸体积V3,并分析",tag:[TAG_DDG_DDG,TAG_DDG],othertag:[3046,3047],action:ACTION_DO8},
	
	{tip:"恭喜过关",over:true}
];
over = {tip:"恭喜过关"};



